import request from '@/config/axios'

// 设备分类 VO
export interface DeviceCategoryVO {
  id: number // 主键ID
  categoryName: string // 分类名称
  parentId: number // 父分类ID
  description: string // 分类说明
}

// 设备分类 API
export const DeviceCategoryApi = {
  // 查询设备分类列表
  getDeviceCategoryList: async (params) => {
    return await request.get({ url: `/agent/device-category/list`, params })
  },

  // 查询设备分类详情
  getDeviceCategory: async (id: number) => {
    return await request.get({ url: `/agent/device-category/get?id=` + id })
  },

  // 新增设备分类
  createDeviceCategory: async (data: DeviceCategoryVO) => {
    return await request.post({ url: `/agent/device-category/create`, data })
  },

  // 修改设备分类
  updateDeviceCategory: async (data: DeviceCategoryVO) => {
    return await request.put({ url: `/agent/device-category/update`, data })
  },

  // 删除设备分类
  deleteDeviceCategory: async (id: number) => {
    return await request.delete({ url: `/agent/device-category/delete?id=` + id })
  },

  // 导出设备分类 Excel
  exportDeviceCategory: async (params) => {
    return await request.download({ url: `/agent/device-category/export-excel`, params })
  }
}